<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<div class="art-layout-cell art-content">
<div class="art-box art-post">
    <div class="art-box-body art-post-body">
<div class="art-post-inner art-article">
                                <h2 class="art-postheader">Giỏ Hàng
                                </h2>
                                                <div class="art-postcontent">
                                                <form id="form1" name="form1" method="post" action="cart.do?action=process">
                                                <table width="571" height="152" border="1">
  <tr>
    <th width="29">Stt</th>
    <th width="96">Hình </th>
    <th width="123">Tên Sản Phẩm</th>
    <th width="79">Số Lượng</th>
    <th width="82">Giá Bán</th>
    <th width="74">Thành Tiền</th>
    <th width="42">Xóa</th>
  </tr>
  <c:set var="total" value="0" />
  <c:forEach var="item" items="${cart}" >
  <tr>
      <td>1</td>
    <td> <a href="product-details.do?id=<c:out value="${item.id}"/>" target="_parent"><img src="images/<c:out value="${item.hinhAnh}"/>" alt="product" /></a></td>
    <td><c:out value="${item.tenSanPham}" /></td>
    <td>
        <input type="text" name="qty" id="qty" value="<c:out value="${item.soLuong}"/>" /></td>
    <td><c:out value="${item.giaBan}"/></td>
    <td><c:out value="${item.giaBan*item.soLuong}"/></td>
    <c:set var="total" value="${total+(item.giaBan*item.soLuong)}" />
    <td><a href='<c:out value="cart.do?action=delete&catid=${item.id}"/>'>Xóa</a></td>
  </tr>
  </c:forEach>
  <tr>
    <td colspan="5"><div align="right">Thành Tiền</div></td>
    <td colspan="2"><div align="right"><c:out  value="${total}"/>  VNĐ</div></td>
    </tr>
  <tr>
    <td colspan="2"><div align="center"><a href="product.do?action=view" target="_parent">Tiếp Tục Mua</a></div></td>
    <td colspan="2"><div align="center">
      <input type="submit" name="update" id="update" value="Cập Nhật" />
    </div>
    <td colspan="3"><div align="center">
      <input type="submit" name="payment" id="payment" value="Thanh Toán" />
    </div></td>
    </tr>
</table></form></td>
</div>
                    </div>
                </div>
            </div>
           